{layout name="layout" /}
<div class="tipbox tipbox-error mb5">
    <span class="fn-fb">友情提示:</span>
    <br />聚变类型,默认只保产品本金给用户,并且不奖励推广用户,如需要开启,请到配置中打开（开启后用户的利润和奖励资金由公司承担）
</div>
<form id="form" action="{:url('fastshop/sale/edit')}">
    <input type="hidden" name="id" value="{$id}"/>
    <table class="formtable" id="gift">
        <tr>
            <th>抢购时间:</th>
            <td>
                <select datatype="*" class="select w200" name="category_id">
                    <option value="0">不分时间</option>
                    {foreach $times as $rs}<option value="{$rs.id}" {if $info.category_id == $rs.id}selected{/if}>{$rs.name}</option>{/foreach}
                </select>
                <span class="gray">可不选择抢购时间归类</span>
            </td>
        </tr>
        <tr>
            <th>活动类型:</th>
            <td>
                <select datatype="*" class="select w200 is_fusion" name="is_fusion">
                    <option value="0" {if $info.is_fusion == 0}selected{/if}>裂变类型</option>
                    <option value="1" {if $info.is_fusion == 1}selected{/if}>聚变类型</option>
                </select>
            </td>
        </tr>
        <tr><th>活动名称:</th><td><input class="input w500" datatype="*" type="text" name="title" value="{$info.title}"/></td></tr>
        <tr><th>活动状态:</th><td>
            <select datatype="*" class="select w150" name="types">
                <option value="0" {if $info.types == 0}selected{/if}>下线中</option>
                <option value="1" {if $info.types == 1}selected{/if}>进行中</option>
            </select>
            <select datatype="*" class="select w150" name="is_vip">
                <option value="0" {if $info.is_vip == 0}selected{/if}>普通活动</option>
                <option value="1" {if $info.is_vip == 1}selected{/if}>会员活动</option>
            </select>
            <select datatype="*" class="select w150" name="is_newuser">
                <option value="0" {if $info.is_newuser == 0}selected{/if}>老用户</option>
                <option value="1" {if $info.is_newuser == 1}selected{/if}>新用户</option>
            </select>
        </td></tr>
        <tr><th>活动时间:</th><td>
                <input readonly placeholder="开始时间" class="input w160 ui-time" datatype="date" type="text" name="start_time"  value="{$info.start_time|date='Y-m-d H:i:s'}"/>
                <span class="blue">至</span> 
                <input readonly placeholder="结束时间" class="input w160 ui-time" datatype="date" type="text" name="end_time"  value="{$info.end_time|date='Y-m-d H:i:s'}"/>
        </td></tr>
        <tr><th>产品数量:</th><td>
                <input class="input w80" datatype="n" type="text" name="sale_nums" value="{$info.sale_nums}"/>
                <span class="w50">未提货商品数量:<span id="entrust_number" class="red fn-f16 fn-fb"> 0 </span></span>
            </td> 
        </tr>
        <tr><th></th>
            <td class="input-group">
                <input readonly value="产品ID" class="input fn-tac readonly disabled w100" type="text" />
                <input readonly value="成本价" class="input fn-tac readonly disabled w100" type="text" />
                <input readonly value="销售价" class="input fn-tac readonly disabled w100" type="text" />
                <input readonly value="市场价" class="input fn-tac readonly disabled w100" type="text" />
            </td>
        </tr>
        <tr><th class="item_title">{$info.is_newuser?'赠送产品':'销售产品'}:</th><td class="input-group">
            <input autocomplete="off" readonly id="item_id" class="win readonly input w100" datatype="n" type="text" name="item_id" value="{$info.item_id}"/>
            <input autocomplete="off" id="cost_price" class="input w100" type="text" name="cost_price"  value="{$info.cost_price/100|money}"/>
            <input autocomplete="off" id="sale_price" class="input w100" datatype="*" type="text" name="sale_price"  value="{$info.sale_price/100|money}"/>
            <input autocomplete="off" id="market_price" class="input w100" datatype="*" type="text" name="market_price" value="{$info.market_price/100|money}"/>
        </td></tr>
        {if count($info.gift) <= 0}
        <tr class="gift gift_title"><th>{$info.is_newuser?'销售产品':'赠送产品'}:</th><td class="input-group">
            <input autocomplete="off" id="0" readonly class="win input gift_item_id_0 w100" datatype="n" type="text" name="gift[item_id][]" />
            <input autocomplete="off" id="gift_cost_price_0" class="input w100" datatype="npot" type="text" name="gift[cost_price][]" />
            <input autocomplete="off" class="input w100" datatype="npot" type="text" name="gift[sale_price][]" />
            <input autocomplete="off" class="input w100" datatype="npot" type="text" name="gift[market_price][]" />
            <div class="fn-left w50 fn-tac fn-cp" id="add"><i class="iconfont icon-add_icon"></i></div>
        </td></tr>
        {else}
        {foreach $info.gift as $key => $vo}
        <tr>
            <th {if !$key}class="gift_title"{/if}>{if !$key}{$info.is_newuser?'销售产品':'赠送产品'}:{/if}</th>
            <td class="input-group">
                <input autocomplete="off" id="{$key}" readonly class="win readonly w100 input gift_item_id_{$key}" datatype="n" type="text" name="gift[item_id][]" value="{$vo.item_id}"/>
                <input autocomplete="off" id="gift_cost_price_{$key}" class="input w100" datatype="npot" type="text" name="gift[cost_price][]"  value="{$vo.cost_price/100|money}"/>
                <input autocomplete="off" class="input w100" datatype="npot" type="text" name="gift[sale_price][]"  value="{$vo.sale_price/100|money}"/>
                <input autocomplete="off" class="input w100" datatype="npot" type="text" name="gift[market_price][]"  value="{$vo.market_price/100|money}"/>
            {if $key}
                <div class="fn-left w50 fn-tac fn-cp" onClick="delGift(this)"><i class="iconfont icon-reduce_icon"></i></div>
            {else}
                <div class="fn-left w50 fn-tac fn-cp" id="add"><i class="iconfont icon-add_icon"></i></div>
            {/if}
            </td>
        </tr>
        {/foreach}
        {/if}
        <tr><th></th><td>
            <input type="submit" value="确定" class="button button-blue submit" />
            <input type="reset" value="重置" class="button button-blank" />
        </td></tr>
    </table>
</form>
{include file="sale:js" /}